import VueRouter from 'vue-router'

const routes=[{
    path:'/',
    name:'login',
    component:()=>import('../components/Login')
},
    {
        path:'/SouYe',
        name:'souye',
        component:()=>import('../components/SouYe'),
        children:[
            {
                path:'/Home',
                name:'home',
                meta:{
                  title:'首页'
                },
                component:()=>import('../components/Home')
            },
            {
                path:'/Detail',
                name:'detail',
                meta:{
                    title:'我的'
                },
                component:()=>import('../components/Detail')
            },
            {
                path:'/room-menuMange',
                name:'room-menuMange',
                meta:{
                    title:'菜单管理'
                },
                component:()=>import('../components/room/room-menuMange')
            },
            {
                path:'/room-tipMange',
                name:'room-tipMange',
                meta:{
                    title:'订单管理'
                },
                component:()=>import('../components/room/room-tipMange')
            },
            {
                path:'/room-zuoweiMange',
                name:'room-zuoweiMange',
                meta:{
                    title:'座位管理'
                },
                component:()=>import('../components/room/room-zuoweiMange')
            },
        ]
    }

]

const router=new VueRouter({
    mode:'history',
    routes
})
export function resetRouter() {
    router.matcher=new VueRouter({
        mode:'history',
        routes: []
    }).matcher
}
const VueRouterPush =VueRouter.prototype.push
VueRouter.prototype.push=function push(to) {
    return VueRouterPush.call(this,to).catch(err=>err)
}
export  default router;